#include "head.h"

void login(int sockfd){
    char username[512] = {0};
    char password[512] = {0};
    printf("username: ");
    scanf("%s",username);
    send(sockfd,username,sizeof(username),0);
    printf("password: ");
    scanf("%s",password);

    while(1){
        send(sockfd,password,sizeof(password),0);
        char verify[256] = {0};
        recv(sockfd,verify,sizeof(verify),0);

        if(strcmp(verify,"1")==0){
            printf("登录成功\n");
            break;
        }
        else{
            printf("密码错误，请重新输入\n");
            printf("password: \n");
            scanf("%s",password);
        }
    }
}
